#!/bin/bash

absolute_dir="$( cd "$( dirname "$0" )" && pwd )"

export LD_LIBRARY_PATH=$absolute_dir/lib/linux-`uname -m`
jarpath="$absolute_dir/jar/aster.jar"
android_framework_dir=`grep framework $absolute_dir/../*.properties | cut -d '=' -f 2`
framework=$absolute_dir/jar:$android_framework_dir

debug_parameters=""

if [ z"$1" == z"-debug" ]; then
    debug_parameters='-Xdebug -Xrunjdwp:transport=dt_socket,address=5487,server=y,suspend=n'
    shift
    echo ""
    echo "Run in debug mode.....use jdb by typing...."
    echo "$ jdb -attach 127.0.0.1:5487"
fi

exec java $debug_parameters -Xmx128M -Djava.ext.dirs="$framework" -Dorg.zeroxlab.wookieerunner.bindir="$absolute_dir" -jar "$jarpath" "$@"
